AgxFacebook = 
{
    isLogin:false,
    scope : 'publish_stream',
    friends: false,
    friendsNotUseApp: false,
    friendsUseApp: false,
    
    init: function()
    {            
        FB.init
        (
            {        
                appId  : 'xxx',
                status : true,
                cookie : true,
                xfbml      : true,
                frictionlessRequests : true,
                oauth: true,
                logging: true
            }
       );        
    }, 
    
    loginFB:function()
    {
        FB.login
        (
            function(response) 
            {                         
                if (response.authResponse) 
                {                           
                    AgxFacebook.isLogin = true;
                } 
                else 
                {
                    AgxFacebook.isLogin = false                    
                }
            }, {scope: AgxFacebook.scope});
        
    },
    
    postWallPopUp: function()
    {      
        AgxConstruct.hideUnity();        
        AgxConstruct.showShare();
        
        var _url = "https://www.facebook.com/sharer.php?";
        _url += "u="+encodeURI(warnerConfig.baseurl+'languages/'+warnerConfig.language+'/'+warnerConfig.language+'_sharefacebook.html');        
        console.log(_url);
        
         $(AgxConstruct.aBtnShare).click(function(){AgxConstruct.lancPopUp(_url),  AgxConstruct.hideShare(), AgxConstruct.showUnity();});                       
    },
    
    postWallFB: function(name,caption,description, link)
    {
        FB.ui
        (
            {
                method: 'feed',                
                picture: 'imagens/share/16x16.jpg',
                name: name,
                caption: caption,
                description: description,
                link: link                                
            },  AgxFacebook.call
        )
    },
    getRequest: function()
    {
        AgxConstruct.hideUnity();        
        AgxConstruct.showShare();
        $(AgxConstruct.aBtnShare).click(function(){AgxFacebook.popUpRequest(mensage, maxNumber, excludId, title);});                
    },                
    //excludId = id que devem ser excluidos
    //mensage mensagem para o dialogo
    //maxNumber numero de usuarios maximos que o usuario pode selecionar    
    popUpRequest: function(mensage,maxNumber,excludId, title) 
    {                    
        (typeof excludId == 'undefined')?(excludId = false):(excludId = excludId)                        
        FB.ui(
                {
                    method: 'apprequests',
                    title:title,
                    message: mensagem,
                    exclude_ids: friendsNotUseApp,
                    max_recipients: maxNumber
                }, AgxFacebook.call(result.to)
            );                         
    },
    getFriendUseApp: function()
    {
        FB.api(
                {
                    method: 'friends.getAppUsers'
                },
                function(response) 
                {                
                    AgxFacebook.friendsUseApp = response;
                }
              );        
    },    
    getFriends: function()
    {                
        FB.api(
                {
                    method: 'friends.get'
                },
                function(response) 
                {                
                    AgxFacebook.friends = response;
                }
              );
        
    },    
    getFriendsNotUseApp: function()
    {
        if(AgxFacebook.friendsUseApp && AgxFacebook.friends)
        {
            for()
            
        }
        else
        {
            AgxFacebook.getFriends();
            AgxFacebook.getFriendUseApp();
            return false;            
        }                
    },
    call: function(result)
    {
        AgxConstruct.showUnity();        
    }  
    
}